package homework00102;

import java.util.Arrays;
import java.util.Random;

public class Demo3 {

	public static void main(String[] args) {
		int[] a = {1, 2, 3, 4, 5};
        trunArray(a);
        System.out.println(Arrays.toString(a));
	}

	private static void trunArray(int[] a) {
		Random num=new Random();
		for(int i=a.length-1;i>0;i--){
			int j=num.nextInt(i+1);
			int temp=a[i];
			a[i]=a[j];
			a[j]=temp;
		}
	}

}
